home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Technical Documentation / Sample Code / DTS_SCSI Code (In Development) / DTS_SCSI_Debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-15  |  2.1 KB  |  69 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DTS_SCSI_Debug.h
  3.     
  4.     
  5.     
  6.     
  7.     Unfortunately, no matter how long awaited, it's still not done.  In fact, this
  8. isn't even a release- this is just an image of the code taken in the middle of
  9. development.
  10.  
  11. THIS CODE DOES NOT WORK AS A WHOLE.  MUCH OF IT IS BUGGY AND / OR INCOMPLETE.
  12. YOU WOULD HAVE TO BE ABSOLUTELY INSANE TO USE ANY OF THIS CODE IN YOUR
  13. PROJECT WITHOUT EXTENSIVE THOUGHT, DEBUGGING AND TESTING.
  14.  
  15.  
  16.  
  17.  
  18.  
  19.     Contains:    debugging support
  20.  
  21.     Written by:    Craig Prouse
  22.  
  23.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  24.  
  25.     Change History (most recent first):
  26.  
  27.          <1>    03/10/92    BJS        Add comments to Prouse's original version; check in to new project
  28.  
  29.     To Do:
  30. */
  31.  
  32. /*
  33.  * These macros allow addition of debug-only invariant tests. In a debug build,
  34.  * we can test for a condition that we know should never happen in real life,
  35.  * without having a lot of special-case text; through the use of this "assert"
  36.  * macro, the test will automatically be excluded from production code. This is
  37.  * similar to the mechanism used by the MPW-supplied "assert.h" macros.
  38.  */
  39. #ifndef DEBUG
  40. #define        assert(condition,debugMsg)        ((void) 0)
  41. #define        assertv(condition,debugMsg)        ((void) 0)
  42. #else
  43. // #define        assert(condition,debugMsg)        ((condition) ? (void) 0 : debugstr(debugMsg))
  44.  
  45. // *** comment this
  46. #pragma parameter CritErr(__D0, __D1)
  47. void CritErr(int top, int bottom) = { 0x2C00, 0x2E01, 0x2078, 0x02AE, 0x4EE8, 0x0026 };
  48. // 00000000: 2C01           ',.'              MOVE.L     D0,D7
  49. // 00000002: 2E00           '..'              MOVE.L     D1,D6
  50. // 00000004: 2078 02AE      ' x..'            MOVEA.L    ROMBase,A0
  51. // 00000008: 4EE8 0026      'N..&'            JMP        $0026(A0)
  52.  
  53. // ****** YECCCH
  54. #define        assert(condition,debugMsg)        \
  55.     if (!(condition))                        \
  56.         if (*(long*)0x120)                    \
  57.             debugstr(debugMsg);                \
  58.         else                                \
  59.             CritErr(__FILE_NUMBER__ | __LINE__, 0xDeadFace)  //*** Comment why done this way.
  60.  
  61. #define        assertv(condition,debugVal)        \
  62.     if (!(condition))                        \
  63.         if (*(long*)0x120)                    \
  64.             Debugger();                        \
  65.         else                                \
  66.             CritErr(__FILE_NUMBER__ | __LINE__, debugVal)
  67. #endif
  68.  
  69.